<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><ui:insert name="title">Default Title</ui:insert></title>
        <h:outputStylesheet name="css/jsfcrud.css"/>
    </h:head>

    <h:body>

        <h:form id="form">
            <p:growl id="growl" />

            <p:tabMenu activeIndex="2">  
                <p:menuitem value="Compte[#{loginController.findName()}]" url="index.xhtml" icon="ui-icon-mail-open"/>  
                <p:menuitem value="Acceuil" url="index.xhtml" icon="ui-icon-home" />  
                <p:menuitem value="Catégories" url="Categories.xhtml" icon="ui-icon-folder-collapsed"/>  
                <p:menuitem value="Déconnecter" url="index.xhtml" icon="ui-icon-power" />  
                <p:menuitem value="Rechercher"  url="#" icon="ui-icon-search"> 
                    <h:panelGrid columns="12" cellpadding="0">  
                        <h:outputLabel for="Rechercher" value="Rechercher:" style="font-weight:bold"/>  
                        <p:inputText id="categorieName" value="#{rechercheController.categorieName}" />  
                        <p:commandButton value="go" action="#{rechercheController.Search()}" update="growl"/>  
                    </h:panelGrid> 

                </p:menuitem>
            </p:tabMenu>  

            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>

                <h:dataTable value="#{categController.findByIdCategorie()}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                    <h:column> 
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListProduitTitle_nomProduit}"/>
                        </f:facet>
                        <h:form>
                            <p:commandButton value="#{item.nomProduit}" />
                        </h:form>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListProduitTitle_prix}"/>
                        </f:facet>
                        <h:form>
                            <p:commandButton value="#{item.prix}" />  
                        </h:form>
                    </h:column>

   <!--<p:selectManyCheckbox value="#{acheteController.selectedOptions}" label="#{acheteController.selectedOptions}"> 
     <f:selectItem itemLabel="#{item.nomProduit}" itemValue="#{item.nomProduit}"/>  
 </p:selectManyCheckbox> -->

                    <h:column>
                        <p:commandButton   action="#{acheteController.listeproduit(item)}" value="#{item.nomProduit}" oncomplete="dialogue.show();" update="display"  > 
                        </p:commandButton>
                        <h:form id="display">
                            <p:dialog  header="Selected Values"  modal="true" showEffect="fade" hideEffect="fade" widgetVar="dialogue">  
                                <p:outputPanel>
                                    <p:dataList value="#{acheteController.listproduit}" var="var" >
                                        <p:panel> 
                                            <p:outputLabel value="Nom de produit:#{var.nomProduit}"/>
                                        </p:panel> 
                                        <p:panel> 
                                            <p:outputLabel value="prix de produit:#{var.prix}"/> 
                                        </p:panel> 
                                        
                                        <h:link onclick="#{produitController.createCommande(var)}" value="buy" />
                                         
                                    </p:dataList> 
                                   
                                    <p:selectOneMenu value="#{acheteController.quantite}"> 
                                        <f:selectItem itemLabel="1" itemValue="1"></f:selectItem>
                                        <f:selectItem itemLabel="2" itemValue="2"></f:selectItem>
                                        <f:selectItem itemLabel="3" itemValue="3"></f:selectItem>
                                        <f:selectItem itemLabel="4" itemValue="4"></f:selectItem>
                                        <f:selectItem itemLabel="5" itemValue="5"></f:selectItem>
                                        <f:selectItem itemLabel="6" itemValue="6"></f:selectItem>
                                        <f:selectItem itemLabel="7" itemValue="7"></f:selectItem>
                                        <f:selectItem itemLabel="8" itemValue="8"></f:selectItem>
                                    </p:selectOneMenu>
                                </p:outputPanel>  
                            </p:dialog>
                        </h:form>
                    </h:column>
                </h:dataTable>
            </h:panelGroup>

        </h:form>
    </h:body> 
</html>